/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 - 2008 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
/**
 * 
 */
package com.genia.toolbox.projects.csv.business.manager;

import java.io.File;
import java.util.List;

import com.genia.toolbox.basics.exception.technical.TechnicalException;
import com.genia.toolbox.projects.csv.bean.CsvVersion;
import com.genia.toolbox.projects.csv.bean.MappingDescriptor;

/**
 * interface for managing the csv file version.
 */
public interface CsvVersionManager
{

  /**
   * get the {@link List} of existing {@link CsvVersion}s regarding to the
   * given {@link MappingDescriptor} object.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @return a {@link List} of {@link CsvVersion}s
   * @throws TechnicalException
   *           if an io error occur
   */
  public List<CsvVersion> getVersions(MappingDescriptor mappingDescriptor, File basePath)
      throws TechnicalException;



  /**
   * for getting the corresponding file name to the given {@link CsvVersion}
   * object.
   * 
   * @param version
   *          the {@link CsvVersion} to format.
   * @return the corresponding file name to the given {@link CsvVersion} object
   */
  public String format(CsvVersion version);



  /**
   * for getting the corresponding {@link CsvVersion} object to the given file
   * name.
   * 
   * @param strVersionFile
   *          the formated file name
   * @return a {@link CsvVersion} object
   * @throws TechnicalException
   *           if a parse error occur
   */
  public CsvVersion parse(String strVersionFile)
      throws TechnicalException;



  /**
   * get the last csv version.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @return the last {@link CsvVersion} or null if no version exist
   * @throws TechnicalException
   *           if an io error occur
   */
  public CsvVersion getLastVersion(MappingDescriptor mappingDescriptor, File basePath)
      throws TechnicalException;



  /**
   * get the new csv version.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @return the new {@link CsvVersion}
   * @throws TechnicalException
   *           if an io error occur TechnicalException
   */
  public CsvVersion getNewVersion(MappingDescriptor mappingDescriptor, File basePath)
      throws TechnicalException;

}
